const request = (options)=>{
    uni.showToast({
        icon:'loading',
        title:'加载中'
    })
    const {url, method, header, data} = options;
    const baseURL = 'http://123.56.141.187:8001'
    const p = new Promise((resolve, reject) => {
        uni.request({
            url:baseURL+url,
            method,
            header:{
                ...header
            },
            data,
            success:(res) => {
                resolve(res.data)
            },
            fail:(err)=>{
                reject(err)
            },
            complete:() => {
                uni.hideToast()
            }
        })
    })
    return p;
}

export default request;